/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 九转苍翎
 * Date: 2025/9/3
 * Time: 21:59
 */
public class Solution {
    public String modifyString(String string) {
        char[] charArray = string.toCharArray();
        for (int i = 0; i < charArray.length; i++) {
            //替换
            if (charArray[i] == '?') {
                for (char temp = 'a'; temp <= 'z'; temp++) {
                    if ((i == 0 || temp != charArray[i - 1]) && (i == charArray.length - 1 || temp != charArray[i + 1])) {
                        charArray[i] = temp;
                        break;
                    }
                }
            }
        }
        return String.valueOf(charArray);
    }
    public static void main(String[] args) {
        Solution solution = new Solution();
        String string = solution.modifyString("ab??c");
        System.out.println(string);
    }
}